package com.kaibes.admin.base;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.kaibes.orm.core.util.PageUtils;
import com.kaibes.web.admin.AdminMenu;
import com.kaibes.web.admin.AdminMenuRes;
import com.kaibes.web.thymeleaf.ThymeleafConfig;
import com.kaibes.web.util.WebPageUtils;

@Configuration
public class AdminUiInit implements InitializingBean {

    @Autowired
    private ThymeleafConfig thymeleafConfig;
    
    @Bean
    public AdminMenu indexMenu() {
        AdminMenu indexMenu = new AdminMenu();
        indexMenu.setKey("index");
        indexMenu.setName("仪表盘");
        indexMenu.setIcon("fas fa-desktop");
        indexMenu.setHref("/admin/index");
        indexMenu.setSort(1);
        indexMenu.setParentKey(AdminMenuRes.MENU_HOME);
        return indexMenu;
    }
    
	@Override
	public void afterPropertiesSet() throws Exception {
		thymeleafConfig.putStaticVariable("PageUtils", PageUtils.class);
        thymeleafConfig.putStaticVariable("WebPageUtils", WebPageUtils.class);
	}
}
